#include "util_texture.h"

//----------------PUBLIC METHODS-------------------------------------------------------------------------

/******************************************
* Initialise our Texture by using the Default
* Loading System of the DirectX 10 
* D3DX10CreateShaderResourceViewFromFile Function.
******************************************/
bool LJMUUtilTexture::initialise(ID3D10Device* pdevice,std::wstring pfilename)
{
	HRESULT tloadsuccess;
	tloadsuccess = D3DX10CreateShaderResourceViewFromFile(pdevice, pfilename.c_str(), NULL, NULL, &_obj_tex, NULL);
	if(FAILED(tloadsuccess))
		return false;
	return true;
}

/******************************************
*  Cleanup our texture by releasing the 
*  memory associated and setting the pointer
*  to null.
******************************************/
void LJMUUtilTexture::cleanup()
{
	// Release the texture resource.
	if(_obj_tex)
	{
		_obj_tex->Release();
		_obj_tex = NULL;
	}
	return;
}
